<#if formField.hidden?? && formField.hidden=="1">
<input type=hidden name="fieldMap['${field.name}'].id"  <#if businessInstanceField?? && businessInstanceField.id??>value="${businessInstanceField.id}"</#if>>
<input type=hidden name="fieldMap['${field.name}'].field.id"  value="${formField.field.id}">
<input type=hidden id=${field.name} name="fieldMap['${field.name}'].value" <#if businessInstanceField??>value="${businessInstanceField.value}"</#if>></input>
<#else>
<input type=hidden name="fieldMap['${field.name}'].id"  <#if businessInstanceField?? && businessInstanceField.id??>value="${businessInstanceField.id}"</#if>>
<input type=hidden name="fieldMap['${field.name}'].field.id"  value="${formField.field.id}">
<#if !formField.readonly?? || formField.readonly=="0">
<input type="text"   <#if fieldrule??> datarule="${fieldrule.dataType}"  datarulejson='${fieldrule.json}'  </#if>  id="${field.name}" name="fieldMap['${field.name}'].value" readonly="readonly" <#if businessInstanceField?? && businessInstanceField.value??>value="${businessInstanceField.value}"</#if> class="textTest"></input>
<#else>
<input type=hidden name="fieldMap['${field.name}'].value"  <#if businessInstanceField?? && businessInstanceField.value??>value="${businessInstanceField.value}"</#if>>
<#if businessInstanceField?? && businessInstanceField.value??>${businessInstanceField.value}</#if>
</#if>

<div id="contentDiv" class="dropDD_contentDiv">
	<div style="overflow-y:auto;overflow-x:auto;">
		<table id="yearselect${formField.orderNumber}" style="width:100%;cellpadding="0" cellspacing="0" class="tableFrameClass">
		
		<tr style="height:23px;background-image:url(./../theme/default/images/main/dropDown_t.jpg)">
			<td colspan="5" align="center">
				<a href="javascript:void(0);" onclick="preview${formField.orderNumber}();return false;"><img src="./../theme/default/images/main/date_left.png"/></a>
				&nbsp;&nbsp;
				<label id="startYear${formField.orderNumber}">${startYear}</label>&nbsp;&nbsp;-&nbsp;&nbsp;<label id="endYear${formField.orderNumber}">${endYear}</label>
				&nbsp;&nbsp;
				<a href="javascript:void(0);" onclick="next${formField.orderNumber}();return false;"><img src="./../theme/default/images/main/date_right.png"/></a>
			</td>
		</tr>
		<tr>
			<td colspan="5" align="left" style="word-break:break-all;">
		
				&nbsp;已选择：
		
			</td>
		</tr>
		<tr>
			<td colspan="5" align="center" style="word-break:break-all;">
				<div style="overflow:auto;border:1px solid #82B1C5;background:#ffffff;height:50px;width:95%;_width:100%position:relative;left:5px;text-align:left">
					<span id="selectedYears${formField.orderNumber}"></span>
				</div>
			</td>
		</tr>
		<#assign index = 1>
		<#list year_list as year>
			<#if index==1>
				<tr>
			<#else>
				<#if index%5==1>
					</tr>
					<tr>
				</#if>
			</#if>
			<td><input type="checkbox" onclick="changeStatus(this)" name="yearCheck${formField.orderNumber}" id="year${formField.orderNumber}${index}" <#if businessInstanceField?? && businessInstanceField.value?? && businessInstanceField.value?contains(year)>checked="checked"<#else>checked="false"</#if> value="${year}"/><label id="year${formField.orderNumber}${index}label">${year}</label></td>
			<#if index==year_list?size>
				<#if index%5!=0>
					<#assign col = 5-index%5>
					<td colspan="${col}">&nbsp;</td>
				</#if>
				</tr>
			</#if>
			<#assign index = index + 1>
		</#list>
		
		</table>
	</div>
	<div class="buttonBox" style="position:absolute;bottom:0px;background:#f3f4f4;height:30px;padding-top:4px">
		<a href="#" class="button" tabindex="-1">
		<input type="button" onclick="saveYearSelect${formField.orderNumber}()" value="确认">
		</a>
		&nbsp;&nbsp;
		<a href="javascript:void(0);" class="button" tabindex="-1">
		<input type="button" onclick="clearCheckbox${formField.orderNumber}();return false;" value="清空">
		</a>

	</div>

</div>
<script language="JavaScript">
	var win${formField.orderNumber};
	var value${formField.orderNumber} = '<#if businessInstanceField?? && businessInstanceField.value??>${businessInstanceField.value}</#if>';
	var elParent;
	var cloneEl;
	$(document).ready(function(){
		showSelectedYears${formField.orderNumber}();
	});
	
	function showSelectedYears${formField.orderNumber}() {
		var years = value${formField.orderNumber}.split(",");
		var html = '';
		var enter = '';
		for(var i=0;i<years.length;i++) {
			if((i+1)%7 == 0 ){
				enter = '<br>';
			}
			html += '<a href="javascript:void(0);" onclick="cancelYearSelected${formField.orderNumber}('+years[i]+');return false;">'+years[i]+'</a>';
			html += '&nbsp;&nbsp;'+enter;
			enter = '';
		}
		$('#selectedYears${formField.orderNumber}').html(html);
	}
	
	
	
	function cancelYearSelected${formField.orderNumber}(year) {
		$("input[name='yearCheck${formField.orderNumber}']").each(function(){
				if(this.value==year){
					uncheck${formField.orderNumber}(this);
				}
		});
		removeYear${formField.orderNumber}(year);
	}
	
	function addYear${formField.orderNumber}(check,year) {
		var years = value${formField.orderNumber}.split(',');
		if(years.length>=20) {
			jAlert('最多只能选择20个年份！','提示',function(){});
			uncheck${formField.orderNumber}(check);
			saveYearSelect${formField.orderNumber}();
			return false;	
		}
		var newValue = '';
		var lowValue = '';
		var highValue = '';
		for(var i=0;i<years.length;i++) {
			if(year>years[i]) {
				lowValue += years[i];
				lowValue += ',';
			}
			else if(year<years[i]){
				highValue += years[i];
				highValue += ',';
			}
		}
		newValue = lowValue+year+','+highValue;
		if(newValue!='') {
			newValue = newValue.substring(0,newValue.length-1);
		}
		if(newValue.substring(0,1)==',') {
			newValue = newValue.substring(1,newValue.length);
		} 
		value${formField.orderNumber} = newValue;
		showSelectedYears${formField.orderNumber}();
	}
	function removeYear${formField.orderNumber}(year) {
		var years = value${formField.orderNumber}.split(',');
		var newValue = '';
		for(var i=0;i<years.length;i++) {
			if(year!=years[i]) {
				newValue += years[i];
				newValue += ',';
			}
		}
		if(newValue!='') {
			newValue = newValue.substring(0,newValue.length-1);
		}
		value${formField.orderNumber} = newValue;
		showSelectedYears${formField.orderNumber}();
	}
	
	function showYearSelect${formField.orderNumber}() {
		$('#yearselect${formField.orderNumber}').show();
	}
	function preview${formField.orderNumber}() {
		var startYear = new Number($('#startYear${formField.orderNumber}').text());
		var endYear = new Number($('#endYear${formField.orderNumber}').text());
		$('#startYear${formField.orderNumber}').text(startYear-20);
		$('#endYear${formField.orderNumber}').text(endYear-20);
		refreshPage${formField.orderNumber}(false);
	}
	function next${formField.orderNumber}() {
		var startYear = new Number($('#startYear${formField.orderNumber}').text());
		var endYear = new Number($('#endYear${formField.orderNumber}').text());
		$('#startYear${formField.orderNumber}').text(startYear+20);
		$('#endYear${formField.orderNumber}').text(endYear+20);
		refreshPage${formField.orderNumber}(true);
	}
	function refreshPage${formField.orderNumber}(isNext) {
		$("input[name='yearCheck${formField.orderNumber}']").each(function(){
			if(isNext) {
				var newValue = new Number(this.value) + 20;
				this.value = newValue;
				$('#'+$(this).attr('id')+'label').text(newValue);
			}
			else {
				var newValue = new Number(this.value) - 20;
				this.value = newValue;
				$('#'+$(this).attr('id')+'label').text(newValue);
			}
			uncheck${formField.orderNumber}(this);
			if(value${formField.orderNumber}.indexOf(this.value)!=-1) {
				this.checked = "checked";
			}
		});
		
	}
	function saveYearSelect${formField.orderNumber}() {
		var year = '';
		$("input[name='yearCheck${formField.orderNumber}']").each(function(){
			if(this.checked){
				year+=this.value+',';
			}
		});
		if(year!='') {
			year = year.substring(0,year.length-1);
		}
		$('#${field.name}').focus();
		$('#${field.name}').val(value${formField.orderNumber});
		window.curDDWin.saveWin();
	}
	
	function cancelOperate${formField.orderNumber}(){
		value${formField.orderNumber} = $('#${field.name}').val();
		window.curDDWin.closeWin();
	}
	function redrawWindow${formField.orderNumber}() {
	  value${formField.orderNumber} = $('#${field.name}').val();
	  var currentYear = ${startYear};
	  var max = 3000;
		var minValue = max;
		var years = value${formField.orderNumber}.split(',');
		for(var i=0;i<years.length;i++) {
			if(!years[i] || years[i]=='') {
				years[i] = currentYear;
			}
			if(minValue>years[i]) {
				minValue = years[i];
			}
		}
		if(minValue == max) {
			minValue = currentYear;
		}
		var startYear = startYear${formField.orderNumber}(minValue);
		$('#startYear${formField.orderNumber}').text(startYear);
		$('#endYear${formField.orderNumber}').text(new Number(startYear)+19);
		var thisStartYear = 0;
		$("input[name='yearCheck${formField.orderNumber}']").each(function(){
			var thisYear = new Number(this.value);
			if(thisStartYear==0) {
				thisStartYear = startYear${formField.orderNumber}(thisYear);
			}
			if(thisStartYear!=startYear) {
				var newValue = thisYear + startYear - thisStartYear;
				this.value = newValue;
				$('#'+$(this).attr('id')+'label').text(newValue);
			}
			uncheck${formField.orderNumber}(this);
			if(value${formField.orderNumber}.indexOf(this.value)!=-1) {
				this.checked = "checked";
			}
		});
	}
	
	function startYear${formField.orderNumber}(year) {
		if(parseInt(year/10)%2==0) {
			return 10*(parseInt(year/10)-1);
		}
		else {
			return 10*(parseInt(year/10));
		}
	}
	
	function showplanYear${formField.orderNumber}(){
		redrawWindow${formField.orderNumber}();
		popDD();
	}
	
	$(document).ready(function(){
		$(document.getElementById('${field.name}')).inputStyle({
			operatorId:"companyMenuBtn${formField.orderNumber}",
			operatorType:"text",
			operatorText:"选择",
			controllerWidth:<#if formField.width??>"${formField.width}"<#else>200</#if>,
			operatorFun:showplanYear${formField.orderNumber},
			imgFun:clearCheckbox${formField.orderNumber}
		});
	});
	
	function popDD(){
		new DDWin({
			el:'contentDiv'
			,dep:'divAround_${field.name}'
			,width:290
			,height:240
		})
	}
	function clearCheckbox${formField.orderNumber}(){
	$("#yearselect${formField.orderNumber}").find('input[type="checkbox"]').each(function(){
		uncheck${formField.orderNumber}(this);
	});
		value${formField.orderNumber}='';
		$(document.getElementById('${field.name}')).val("");
		
		$('#selectedYears${formField.orderNumber}').html('');
	}
	//steven
	function changeStatus(obj){
		if($.browser.msie&&($.browser.version == "6.0" || $.browser.version == "7.0")){
			if(obj.checked){
				//obj.checked="checked";
				addYear${formField.orderNumber}(obj,$(obj).attr("value"));
			}else{
				//obj.checked=false;
				removeYear${formField.orderNumber}($(obj).attr("value"));
			}
		}else{
			if($(obj)[0].checked){
				//$(obj)[0].checked=false;
				addYear${formField.orderNumber}(obj,$(obj).attr("value"));
			}else{
				//$(obj)[0].checked="checked";
				removeYear${formField.orderNumber}($(obj).attr("value"));
			}
		}
	}
	function uncheck${formField.orderNumber}(obj){
		if($.browser.msie&&($.browser.version == "6.0" || $.browser.version == "7.0")){
			obj.checked=false;
		}
		else {
			$(obj)[0].checked=false;
		}
	}
</script>
</#if>